<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>
<div id="div1">
    <!--在页面中使用组件-->
    <button-counter></button-counter>

</div>


<script type="application/javascript">
    /*
    *   组件注册
    * */
    Vue.component("button-counter", {
        data: function () {
            return{
                count: 0,
            }
        },
        //定义模板
        template: '<button @click="handle">点击{{count}}</button>',
        methods:{
            handle: function () {
                this.count += 1;
            },
        }
    });

    const vm = new Vue({
        el: "#div1",
        data: {

        },

    })
</script>
</body>
</html>